#define _CRT_SECURE_NO_WARNINGS 1
#include"Heap.h"

void Heap_Sort(int * arr,int n)
{
	for (int i = 0; i <= n;++i)
	{
		Adjust_Up(arr, i);
	}
	for (int i = n; i > 0; --i)
	{
		Swap(&arr[0], &arr[i]);
		Adjust_Down(arr, i - 1);
	}
}

int main()
{
	int arr[] = { 25,65,87,45,1,36,58,96,887,45,65,21 };
	Heap_Sort(arr, sizeof(arr) / sizeof(int) - 1);
	for (int i = 0; i < sizeof(arr) / sizeof(arr[0]);++i)
	{
		printf("%d ", arr[i]);
	}
	printf("\n");
	return 0;
}
